﻿<!DOCTYPE>

<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=EDGE;IE=11;IE=8,chrome=1" />
    <title>工装工具热处理记录</title>
    <link href="/InSiteWebApplication/Content/Easyui/themes/metro/easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/custom-easyui.css" rel="stylesheet" />
    <link href="/InSiteWebApplication/Content/Easyui/themes/icon.css" rel="stylesheet" />
    <style type="text/css">
       tr,td{border:1px solid;padding:7px 10px;height:40px;}
       .tdd{width:110px;text-align:center}
       .adddt,.adddtt{text-align: center;}
    </style>
</head>
<body>
    <div style="justify-content: center;display: flex;padding-top:20px">
            <table class="tabel" cellspacing="0" style="margin: auto">
                    <tr><td colspan="7" style="text-align:center;font-size: 20px;">工装工具分公司热处理记录表</td></tr>
	    		    <tr>
                        <td rowspan="2" style="width:70px;text-align:center">基础</br>信息</td>
	    			    <td colspan="2">材料<label class="MATERIALNAME" style="margin-left:10px"></label></td>
                        <td class="tdd">工序</td>
                        <td colspan="3" class="SPECNAME">
                            <!--<input class="easyui-radiobutton" labelWidth="40px" labelPosition="after" name="SPECNAME" value="0" label="退火" checked/>
                            <input class="easyui-radiobutton" labelWidth="40px" labelPosition="after" name="SPECNAME" value="1" label="淬火" />
                            <input class="easyui-radiobutton" labelWidth="40px" labelPosition="after" name="SPECNAME" value="2" label="回火" />
                            <input class="easyui-radiobutton" labelWidth="40px" labelPosition="after" name="SPECNAME" value="3" label="渗碳" />-->
                        </td>
	    		    </tr>
	    		    <tr>
                        <td colspan="2">设备<label class="RESOURCENAME"  style="margin-left:10px"></label></td>
                        <td class="tdd">日期</td>
                        <td colspan="3"><label class="HEATRECORDDATE" ></label></td>
                    </tr>
                    <tr>
                        <td rowspan="3" style="width:70px;text-align:center"">工艺</br>参数</td>
	    			    <td class="tdd">装炉温度</br>/℃</td>
                        <td class="tdd">装炉时间</td>
                        <td class="tdd">保温温度</br>/℃</td>
                        <td class="tdd">加热到温度</br>时间</td>
                        <td class="tdd">出炉时间</td>
                        <td class="tdd">冷却介质</td>
	    		    </tr>
	    		    <tr class="adddtt">
	    			    <td><span  class="SHOVECHARGETEMPERATURE" /></td>
	    			    <td><span  class="SHOVECHARGETIME" /></td>
                        <td><span  class="KEEPWARMTEMPERATURE" /></td>
	    			    <td><span  class="HEATTOTEMPERATURETIME" /></td>
                        <td><span  class="OUTCHARGETIME" /></td>
                        <td><span  class="COOLANT"  /></td>
	    		    </tr>    
	    		    <tr class="dg adddtt">    
	    			    <td><span  class="SHOVECHARGETEMPERATURE1"  /></td>
                        <td><span  class="SHOVECHARGETIME1" /></td>
	    			    <td><span  class="KEEPWARMTEMPERATURE1" /></td>
                        <td><span  class="HEATTOTEMPERATURETIME1"  /></td>
                        <td><span  class="OUTCHARGETIME1" /></td>
	    		        <td><span  class="COOLANT1"  /></td>
                    </tr >
	    	    </table>
    </div>
</body>
</html>
<script src="/InSiteWebApplication/Scripts/json2.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/jquery.easyui.min.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Content/Easyui/easyui-lang-zh_CN.js" type="text/javascript"></script>
<script src="/InSiteWebApplication/Scripts/CustomPageJs/CustomCommon.js" type="text/javascript"></script>
<script>
    /*
    创建人：longb
    日期：2022-09-26
    描述：热处理记录js
    */
    var page = {
        workflowstepid: getParam("id"),
        ContainerID: getParam("ContainerID"),
        rootPath: getRootPath(), //网站根路径
        ajaxUrl: getRootPath() + "/Ashx/GongZhuangContainer/GZHeatRecordInfoHandler.ashx",
        //初始化页面
        init: function () {
            page.GetHeatRecordInfo();
        },
        //查询热处理记录
        GetHeatRecordInfo: function () {
            var param = {
                action: "GetHeatRecordInfo",
                ContainerID: page.ContainerID,
                workflowstepid: page.workflowstepid
            };
            page.post(param, function (res) {
                if (res.Result) {
                    //console.info(res);
                    $('#BaseForm').form('load', res.DBDataSet.base[0])
                    $.each(res.DBDataSet.base, function (index, item) {
                        $('.MATERIALNAME').text(item.MATERIALNAME == null ? "" : item.MATERIALNAME);
                        $('.RESOURCENAME').text(item.RESOURCENAME == null ? "" : item.RESOURCENAME);
                        $('.HEATRECORDDATE').text(item.HEATRECORDDATE == null ? "" : item.HEATRECORDDATE);
                        var spec = "";
                        if (item.SPECNAME == "0") { spec += "退火<span style='font-size: 16px;margin-right:20px'>☑</span>" } else { spec += "退火<span style='font-size: 22px;margin-right:20px'>□</span>"; }
                        if (item.SPECNAME == "1") { spec += "淬火<span style='font-size: 16px;margin-right:20px'>☑</span>" } else { spec += "淬火<span style='font-size: 22px;margin-right:20px'>□</span>"; }
                        if (item.SPECNAME == "2") { spec += "回火<span style='font-size: 16px;margin-right:20px'>☑</span>" } else { spec += "回火<span style='font-size: 22px;margin-right:20px'>□</span>"; }
                        if (item.SPECNAME == "3") { spec += "渗碳<span style='font-size: 16px;margin-right:20px'>☑</span>" } else { spec += "渗碳<span style='font-size: 22px;margin-right:20px'>□</span>"; }
                        $('.SPECNAME').html(spec);
                    });
                    $.each(res.DBDataSet.spec, function (index, item) {
                        if (index > 0) {
                            $('.SHOVECHARGETEMPERATURE1').text(item.SHOVECHARGETEMPERATURE == null ? "" : item.SHOVECHARGETEMPERATURE);
                            $('.SHOVECHARGETIME1').text(item.SHOVECHARGETIME == null ? "" : item.SHOVECHARGETIME);
                            $('.KEEPWARMTEMPERATURE1').text(item.KEEPWARMTEMPERATURE == null ? "" : item.KEEPWARMTEMPERATURE);
                            $('.HEATTOTEMPERATURETIME1').text(item.HEATTOTEMPERATURETIME == null ? "" : item.HEATTOTEMPERATURETIME);
                            $('.OUTCHARGETIME1').text(item.OUTCHARGETIME == null ? "" : item.OUTCHARGETIME);
                            $('.COOLANT1').text(item.COOLANT == null ? "" : item.COOLANT);
                        } else {
                            $('.SHOVECHARGETEMPERATURE').text(item.SHOVECHARGETEMPERATURE) == null ? "" : item.SHOVECHARGETEMPERATURE;
                            $('.SHOVECHARGETIME').text(item.SHOVECHARGETIME == null ? "" : item.SHOVECHARGETIME);
                            $('.KEEPWARMTEMPERATURE').text(item.KEEPWARMTEMPERATURE == null ? "" : item.KEEPWARMTEMPERATURE);
                            $('.HEATTOTEMPERATURETIME').text(item.HEATTOTEMPERATURETIME == null ? "" : item.HEATTOTEMPERATURETIME);
                            $('.OUTCHARGETIME').text(item.OUTCHARGETIME == null ? "" : item.OUTCHARGETIME);
                            $('.COOLANT').text(item.COOLANT == null ? "" : item.COOLANT);
                        }
                    });
                    var dghtml = "";
                    $.each(res.DBDataSet.dg, function (j, item) {
                        if (j % 2 != 0 && j != 0) {
                            dghtml += "<td colspan='3'>" + item.DRAWINGNO + "</td></tr>";
                        }
                        else {
                            dghtml += "<tr class='adddt'>";
                            if (j == 0) { dghtml += "<td class='Firsttd'></td>" }
                            dghtml += "<td colspan='3'>" + item.DRAWINGNO + "</td>";
                            if (res.DBDataSet.dg.length - 1 == j && res.DBDataSet.dg.length % 2 != 0) {
                                dghtml += "<td colspan='3'></td></tr>";
                            }
                        }
                    })
                    var rowCount = res.DBDataSet.dg.length % 2 == 0 ? res.DBDataSet.dg.length / 2 : res.DBDataSet.dg.length / 2 + 1;
                    if (res.DBDataSet.dg.length != 0 && res.DBDataSet.dg.length / 2 < 20) {
                        for (var i = 0; i <= 20 - rowCount; i++) {
                            dghtml += "<tr class='adddt'><td colspan='3'></td><td colspan='3'></td></tr>";
                        }
                    }
                    if (res.DBDataSet.dg.length == 0) {
                        for (var i = 0; i < 20; i++) {
                            if (i == 0) {
                                dghtml += "<tr class='adddt'><td rowspan='20'></td><td colspan='3'></td><td colspan='3'></td></tr>";
                            } else {
                                dghtml += "<tr class='adddt'><td colspan='3'></td><td colspan='3'></td></tr>";
                            }
                        }
                    }
                    dghtml += '<tr ><td colspan="4">操作者：</td><td colspan="3">检验员：</td></tr>';
                    $(".dg").after(dghtml); //console.info(rowCount); console.info($(".dg").siblings('.adddt'));
                    $(".Firsttd").attr("rowspan", ($(".dg").siblings('.adddt').length));
                }
            });
        },
        //清除方法，重要！！！
        reset: function (iscondition, isresult) {
            clearMessage();
        },
        //post数据
        post: function (param, callback) {
            $.ajax({
                type: "Post",
                url: page.ajaxUrl,
                data: param,
                cashe: false,
                async: true,
                dataType: "json",
                beforeSend: function () {
                    $.messager.progress({ text: '', msg: '处理中...' });
                },
                success: function (data) {
                    $.messager.progress('close');
                    callback(data);
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    $.messager.progress('close');
                    displayMessage(XMLHttpRequest.responseText, false);
                }
            });
        }
    }
    $(function () {
        page.init();
    });
</script>